package mil.af.amc.adpetracker.util;

import org.springframework.aop.AfterReturningAdvice;

import java.lang.reflect.Method;
import java.util.Collection;

/**
 * Please Fill in this Javadoc
 *
 * @author TSgt Jason Ferguson
 */

public class AfterEquipmentItemDaoAdvise implements AfterReturningAdvice {

    public void afterReturning(Object returnValue, Method method, Object[] args, Object target) throws Throwable {

        System.out.println("Call to " + method + " completed.");
        if (returnValue == null) {
            System.out.println("No results returned.");
        } else
        if (returnValue instanceof Collection) {
            System.out.println("Total of " + ((Collection) returnValue).size() + " results returned.");
        } else {
            System.out.println("1 result returned.");
        }
    }
}
